package com.easygem.business.service.imp;

import com.easygem.business.mapper.BgClientFollowMapper;
import com.easygem.business.service.BgClientFollowService;
import com.easygem.business.service.base.AbstractServiceImpl;
import com.easygem.common.model.business.BgClientFollow;
import com.easygem.common.response.ActiveUser;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 肖智
 * @version 1.0
 * @Description TODO
 * @date 2024/12/30
 */
@Service
public class BgClientFollowServiceImpl extends AbstractServiceImpl<BgClientFollowMapper, BgClientFollow, Integer> implements BgClientFollowService {
    @Autowired
    private BgClientFollowMapper bgClientFollowMapper;

    @Override
    public List<BgClientFollow> getBgClientFollowListByClientId(Long clientId) {
        return bgClientFollowMapper.getBgClientFollowListByClientId(clientId);
    }

    @Override
    public Integer addBgClientFollow(BgClientFollow bgClientFollow) {
        return bgClientFollowMapper.addBgClientFollow(bgClientFollow);
    }

    /**
     * 根据员工ID和当前时间得到提醒信息
     *
     * @return
     */
    @Override
    public List<BgClientFollow> selectBgClientFollowList() {
        //获得到登录后的用户信息，通用方式
        ActiveUser activeUser = (ActiveUser) SecurityUtils.getSubject().getPrincipal();
        return bgClientFollowMapper.selectBgClientFollowList(activeUser.getEmployee().getEmpId());
    }
}
